home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11122 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: sdrc.com!thor!scjones
  2. From: larry.jones@sdrc.com (Larry Jones)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: operator % - compiler error
  5. Date: 21 Mar 1996 22:07:53 GMT
  6. Organization: SDRC Engineering Services
  7. Distribution: world
  8. Message-ID: <4isjvp$c23@info1.sdrc.com>
  9. References: <4ini8g$i1u@spanky.pls.ov.com> <4iro6q$2e9@nntp.interaccess.com>
  10. NNTP-Posting-Host: thor.sdrc.com
  11. Originator: scjones@thor
  12.  
  13. In article <4iro6q$2e9@nntp.interaccess.com>, brianmcg@interaccess.com (Brian V. McGroarty) writes:
  14. > This is something I've wondered about.  Why isn't the mod operator defined
  15. > for floating point math?  It can be implemented easily enough via something
  16. > like:
  17. > #define MOD( base, op ) ( (base) - ( (base) / (op) ) * (op) )
  18.  
  19. Not quite -- you need to convert the result of the division to an
  20. integer somehow before multiplying.  Simply put, floating point
  21. remainder is a complicated enough operation that it got a library
  22. routine (fmod or modf, I can never remember which is which) instead.
  23. ----
  24. Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
  25. larry.jones@sdrc.com
  26. Why can't I ever build character in a Miami condo or a casino somewhere?
  27. -- Calvin
  28.